/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 *  \file     Sent_Ip.h                                                                                 *
 *  \brief    This file contains interface header for Sent low level driver                             *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2024/10/22     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/
#ifndef SENT_IP_H
#define SENT_IP_H
/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "lld_platform.h"

/**
 *  \addtogroup SENT_MACRO SENT macro.
 *  \{
 */
/**
 *  \name Sent_Ip Error Codes
 *
 *  Error codes returned by Sent_Ip functions
 *  \{
 */
/********************************************************************************************************
 *                                 Global Macro definition                                              *
 *******************************************************************************************************/
#if defined (CFG_PLATFORM_MCAL)
/** \brief ERROR Description:CRC parameters need to be configured. */
#define SENT_E_CRC_CFG_FAILED   ((uint8)0x80U)
/** \brief ERROR Description:Enabling frameLenChkEn requires calibSel = SENT_SYNC_PULSE_OPTION2 and
 * pausePulseEn = true. */
#define SENT_E_FRAME_CHK   ((uint8)0x81U)
#elif defined (CFG_PLATFORM_SSDK)
/** \brief ERROR Description:CRC parameters need to be configured. */
#define SENT_E_CRC_CFG_FAILED   SDRV_ERROR_STATUS(SDRV_STATUS_GROUP_SENT, 0U)
/** \brief ERROR Description:Enabling frameLenChkEn requires calibSel = SENT_SYNC_PULSE_OPTION2 and
 * pausePulseEn = true. */
#define SENT_E_FRAME_CHK   SDRV_ERROR_STATUS(SDRV_STATUS_GROUP_SENT, 1U)
#endif /* #if defined (CFG_PLATFORM_MCAL) */
/** \} */
/** \} */

/********************************************************************************************************
 *                                 Private Macro definition                                             *
 *******************************************************************************************************/
/** polling status max value */
#define SENT_POLLING_RST_TMS (5000UL)

/**
 *  \addtogroup SENT_CFG SENT Configuration.
 *  \{
 */
/********************************************************************************************************
 *                                  Global Types definition                                             *
 *******************************************************************************************************/
/** \brief sent hw channel ID */
typedef enum
{
    /** channel 0 */
    SENT_CHANNEL0 = 0UL,
    /** channel 1 */
    SENT_CHANNEL1,
    /** channel 2 */
    SENT_CHANNEL2,
    /** channel 3 */
    SENT_CHANNEL3,
    /** channel 4 */
    SENT_CHANNEL4,
    /** channel 5 */
    SENT_CHANNEL5,
    /** channel mac */
    SENT_CHANNEL_MAX,
} Sent_Ip_ChannelType;

/** \brief sent hw channel status */
typedef enum
{
    /** no error */
    SENT_VALID = 0x0UL,
    /** BUS_IDLE : WDT timeout */
    SENT_ERR_IDLE = 0x01UL << 0UL,
    /** CAL_RESYNC : Indicate successive calibration
     * check has faild three time continuously */
    SENT_ERR_THREE_RESYNC_1P5625 = 0x01UL << 1UL,
    /** CAL_LEN_ERR : Indicatreceived diagnose
     * check found current Calibration Pulse
     * has period error Greater than +/- 25% */
    SENT_ERR_CAL_PULSE_25 = 0x01UL << 2UL,
    /** SER_MSG_OFLOW : serial message data overflow */
    SENT_ERR_SER_OVERFLOW = 0x01UL << 3UL,
    /** DATA_OFLOW : nibble frame message data overflow */
    SENT_ERR_NIB_OVERFLOW = 0x01UL << 4UL,
    /** CAL_DRIFT_ERR : Successive Calibration
     * pulse period drift over 1/64 */
    SENT_ERR_CAL_PULSE_DRIFT_1P5625 = 0x01UL << 5UL,
    /** NIBBLE_VAL_ERR :  nibble data less than 0
     * or greater than 15 */
    SENT_ERR_NIBBLE_VAL = 0x01UL << 6UL,
    /** NUM_EDGE_ERR : number of falling edges
     * between two calibration pulse isn't expected */
    SENT_ERR_NUM_EDGE = 0x01UL << 7UL,
    /** SER_MSG_CRC_ERR : serial message or enhanced
     * serial message CRC error */
    SENT_ERR_SER_CRC = 0x01UL << 8UL,
    /** DATA_CRC_ERR : currentframe data CRC error */
    SENT_ERR_NIBBLE_CRC = 0x01UL << 9UL,
    /** RISE_GLITCH_FLAG : rising glitch flag shows
     * the status of the tising flitch detection */
    SENT_ERR_RIS_GLITCH = 0x01UL << 10UL,
    /** FALL_GLITCH_FLAG : falling glitch flag shows
     * the status of the tising flitch detection */
    SENT_ERR_FAL_GLITCH = 0x01UL << 11UL,
    /** NIBBLE_PUSLE_LOW : nibble pulse low time less
     * 4ticks flag */
    SENT_ERR_NIBBLE_PULSE = 0x01UL << 12UL,
    /** CLIB_PUSLE_LOW : cliberation pulse low time less
     * 4ticks flag */
    SENT_ERR_CALIB_PULSE = 0x01UL << 13UL,
    /** SUS_FRAME_LEN_ERR : Susessive ratio of calib
     * pulse to frame length difference over 1.5625% */
    SENT_ERR_FRAME_LEN = 0x01UL << 14UL,
    /** CAL_LEN_20_ERR : Calibration Pulse length
     * error exceed 20% of nominal length */
    SENT_ERR_CAL_LEN_20 = 0x01UL << 15UL,
    /** SPC_UNEXP_PLS : Unexpected incoming low pulse
     * when SPC is enabled and idle */
    SENT_ERR_SPC_UNEXP_PLS = 0x01UL << 16UL,
    /** SPC_UNEXP_TRIG : Unexpected incoming low pulse
     * when SPC is enabled and idle */
    SENT_ERR_SPC_UNEXP_TRIG = 0x01UL << 17UL,
    /** SER_FRAME_UNDER_RUN : Serial frame FIFO under
     * run flag */
    SENT_ERR_SER_UNDER_RUN = 0x01UL << 18UL,
    /** SER_NIB_UNDER_RUN : nibble frame FIFO under
     * run flag */
    SENT_ERR_NIBBLE_UNDER_RUN = 0x01UL << 19UL,
    /** PULSE_CNT_OFLOW : overlength pulse causing
     * the counter of pulse overflow */
    SENT_ERR_PULSE_OFLOW = 0x01UL << 20UL,
    /** TX_IDLE : Indicate channel is in TX inactive status */
    SENT_STA_TX_IDLE = 0x01UL << 28UL,
    /** SPC_IDLE : spc idle flag */
    SENT_STA_SPC_IDLE = 0x01UL << 29UL,
    /** SER_FRAME_READY : serial frame FIFO valid */
    SENT_STA_SER_READY = 0x01UL << 30UL,
    /** NIB_FRAME_READY : nibble frame FIFO valid */
    /* PRQA S 0646 1 */
    SENT_STA_NIBBLE_READY = 0x01UL << 31UL,
} Sent_Ip_ChannelStaType;

/**
 *  \brief  TimeStamp latch lock
 */
typedef enum
{
    /* sent time stamp lock */
    SENT_TIME_STAMP_LATCH_LOCK = 0UL,
    /* sent time stamp unlock */
    SENT_TIME_STAMP_LATCH_UNLOCK,
} Sent_Ip_TimeStampOpType;

/**
 *  \brief  channel CRC mode select
 */
typedef enum
{
    /* SAE standrad way(16 LUT,rolling first) */
    SENT_STANDARD = 0UL,
    /* Alternative way(16LUT,XOR first) */
    SENT_XOR_FIRST,
} Sent_Ip_ChanCRCModeType;

/**
 *  \brief  Calibration pulse period will valid
 */
typedef enum
{
    /* only reject calib pulse when dviation > 25%  */
    SENT_CAL_PULSE_25 = 0UL,
    /* reject calib pulse when period divation > 20% */
    SENT_CAL_PULSE_20,
} Sent_Ip_CalibPulseType;

/** \brief  Defines whether the current SENT frame
 * should be verified against preceding SENT frame/ last
 * valid preceding SENT frame for successive sync pulse
 * difference (> 1.5625 %). If SENT_SYNC_PULSE_OPTION1 is
 * selected, the sync pulse of the current frame is
 * compared to sync pulse of the immediate preceded frame.
 * This is the preferred option as per standard 5.3.3.1
 * If SENT_SYNC_PULSE_OPTION2 is selected, the sync
 * pulse of the current frame is compared to sync pulse
 * of the last valid preceded frame.
 */
typedef enum
{
    /* option1  */
    SENT_SYNC_PULSE_OPTION1 = 0UL,
    /* option2 */
    SENT_SYNC_PULSE_OPTION2,
} Sent_Ip_PulseSelType;

/** \brief CRC mode select
 */
typedef enum
{
    /* J2716 2010  */
    SENT_SAE_J2716_2010 = 0UL,
    /* J2716 2008 */
    SENT_SAE_J2716_2008,
} Sent_Ip_Crc4ModeType;

/** \brief Frame type
 */
typedef enum
{
    /* nibble data  */
    SENT_NIBBLE_FRAME = 0UL,
    /* serial data */
    SENT_SERIAL_FRAME,
} Sent_Ip_FrameType;

/**
 *  \brief  channel crc ctrl
 */
typedef struct
{
    /** Determin the CRC4 calculation way */
    Sent_Ip_ChanCRCModeType chanCrcMode;
    /** enable status nibble into crc4 */
    bool statusNibCrc;
    /** crc4 serial select */
    Sent_Ip_Crc4ModeType serDataCrc4;
    /** crc4 nibble select */
    Sent_Ip_Crc4ModeType nibbleDataCrc4;
} Sent_Ip_Crc4CtrlType;

/**
 *  \brief  channel ctrl
 */
typedef struct
{
    /** tick divider*/
    uint32_t div;
    /** tick counter */
    uint32_t tickCoun;
    /** WDT counter , 0 means closed */
    uint32_t wdtLen;
    /** Ignore the first serial frame */
    bool ignoreFirSer;
    /** CRC4 disable */
    bool frameCrcDisable;
    /** CRC4 or CRC6 disable */
    bool serialCrcDisable;
    /** Determine if the first calibration pulse after Channel
     *  enable need succesive pulse check 1/64 diff against
     *  norminal value  */
    bool FirstCalPulseChk;
    /** only enable CRC6 or disable CRC4,
     * you can just write null here. */
    const Sent_Ip_Crc4CtrlType *crc4Cfg;
    /** select calibration pulse */
    Sent_Ip_CalibPulseType calibPulse;
    /** pulse check mode select */
    Sent_Ip_PulseSelType calibSel;
    /** enhanced message mode */
    bool enhancedDataEn;
    /** Frame lenggth chk, need calibSel = SENT_SYNC_PULSE_OPTION1*/
    bool frameLenChkEn;
    /** pause pulse enable */
    bool pausePulseEn;
    /** nibble number.data_nibble_num = nibbleNum */
    uint32_t nibbleNum;
    /** Defines the the sequence in which the received
     * data nibbles shall be presented to the user for
     * the respective channel.For example 0x76540123 meansReceived
     * nibble 0 goes to bits 12-15 of RDRReceived nibble 1 goes
     * to bits 8-11 of RDRReceived nibble 2 goes to bits 4-7 of
     * RDRReceived nibble 3 goes to bits 0-3 of RDRReceived nibble
     * 4 goes to bits 16-19 of RDRReceived nibble 5 goes to bits
     * 20-23 of RDRReceived nibble 6 goes to bits 24-27 of RDRReceived
     * nibble 7 goes to bits 28-31 of RDR. */
    uint32_t dataView;
    /** When channel is just enabled ,ingnore glitches and not send interrupt */
    bool chnFirstGlitchIgnore;
    /** falling edge glitch filter */
    uint32_t chnGlitchFall;
    /** rising edge glitch filter */
    uint32_t chnGlitchRis;
    /** invert input signal */
    bool invertInputSigEn;
    /** serial data dma mode */
    bool dmaSerEn;
    /** nibble data dma mode */
    bool dmaNibEn;
} Sent_Ip_ChnCtrlType;

/**
 *  \brief  channel config type
 */
typedef struct
{
    /** sent base */
    uint32_t base;
    /** channel ID */
    Sent_Ip_ChannelType channelId;
    /** channel config info */
    Sent_Ip_ChnCtrlType chnCfg;
} Sent_Ip_ChnCfgType;

/**
 *  \brief  nibble frame data type
 */
typedef struct
{
    /** channel ID */
    Sent_Ip_ChannelType channelId;
    /** nibble frame or serial frame */
    Sent_Ip_FrameType frameType;
    /** valid data */
    bool validData;
    /** status communication nibble */
    uint8_t SCN;
    /** CRC */
    uint8_t crc;
    /** nibble data */
    uint32_t nibbleData;
    /** time stamp */
    uint32_t timeStamp;
} Sent_Ip_NibDataType;

/**
 *  \brief  serial frame data type
 */
typedef struct
{
    /** channel ID */
    Sent_Ip_ChannelType channelId;
    /** nibble frame or serial frame */
    Sent_Ip_FrameType frameType;
    /** valid data */
    bool validData;
    /** Configuration bit */
    uint8_t Configuration;
    /** short serial message or enhance
     * serial message */
    uint8_t serMessType;
    /* CRC of the serial data */
    uint8_t crc;
    /* 4/8-bit Message Id */
    uint8_t msgId;
    /* 16/12-bit serial data */
    uint16_t data;
    /** time stamp */
    uint32_t timeStamp;
} Sent_Ip_SerDataType;
/** \} */

/********************************************************************************************************
 *                                  Private Function Declarations                                       *
 *******************************************************************************************************/
/** *****************************************************************************************************
 * \brief div config
 *
 * \verbatim
 * Syntax             : static void Sent_Ip_ChannelDivCtrl(uint32_t base, Sent_Ip_ChannelType channel,
 *                                                         uint32_t tickCoun, uint32_t divider)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      tickCoun - The counter of ticks
 *                      divider - The divider value
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : div config
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelDivCtrl(uint32_t base, Sent_Ip_ChannelType channel, uint32_t tickCoun, uint32_t divider);

/** *****************************************************************************************************
 * \brief Configure the sent timestamp feature to initialise the interface.
 *
 * \verbatim
 * Syntax             : void Sent_Ip_TimeStampInit(uint32_t base,
 *                          uint32_t preDiv)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - Sent base address
 *                      preDiv - Sent time stamp divider
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Configure the sent timestamp feature to initialise the interface.
 * \endverbatim
 *******************************************************************************************************/
/* PRQA S 4604 1 */
void Sent_Ip_TimeStampInit(uint32_t base, uint32_t preDiv);

/** *****************************************************************************************************
 * \brief Used to turn the CNTlock function.
 *
 * \verbatim
 * Syntax             : void Sent_Ip_TimeStampLatch(uint32_t base,
 *                          Sent_Ip_TimeStampOpType option)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - Sent base address
 *                      option - SENT_TIME_STAMP_LATCH_LOCK : latch lock
 *                               SENT_TIME_STAMP_LATCH_UNLOCK : latch unlock
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Used to turn the CNTlock function. A real CNT doesn't stop,
 *                      it just LOCKS the registers.
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_TimeStampLatch(uint32_t base, Sent_Ip_TimeStampOpType option);

/** *****************************************************************************************************
 * \brief clear time stamp cnt
 *
 * \verbatim
 * Syntax             : void Sent_Ip_TimeStampCntClr(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : base - Sent base address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : clear time stamp cnt
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_TimeStampCntClr(uint32_t base);

/** *****************************************************************************************************
 * \brief get time stamp counter
 *
 * \verbatim
 * Syntax             : void Sent_Ip_TimeStampGet(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : base - Sent base address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : time stamp counter
 *
 * Return value       : None
 *
 * Description        : get time stamp counter
 * \endverbatim
 *******************************************************************************************************/
uint32_t Sent_Ip_TimeStampGet(uint32_t base);

/** *****************************************************************************************************
 * \brief Configure the DMA mode function.
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ChannelDmaCtrl(uint32_t base, Sent_Ip_ChannelType channel,
 *                                                  bool dmaNibEn, bool dmaSerEn)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      dmaNibEn - true:Enable nibble_DMA for the channel.
 *                                 false:Disables nibble_DMA for the channel.
 *                      dmaSerEn - true:Enable serial_DMA the channel.
 *                                 false:Disables serial_DMA for the channel.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Configure the DMA mode function.
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelDmaCtrl(uint32_t base, Sent_Ip_ChannelType channel, bool dmaNibEn, bool dmaSerEn);

/** *****************************************************************************************************
 * \brief Configure SENT channel-related configuration.
 *
 * \verbatim
 * Syntax             : lld_status_t Sent_Ip_ChannelCtrl(uint32_t base, Sent_Ip_ChannelType channel,
 *                                                       const Sent_Ip_ChnCfgType *cfg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      cfg - Sent config type
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errorID - SENT_E_CRC_CFG_FAILED or SENT_E_FRAME_CHK
 *
 * Description        : Configure SENT channel-related configuration.
 * \endverbatim
 *******************************************************************************************************/
lld_status_t Sent_Ip_ChannelCtrl(uint32_t base, Sent_Ip_ChannelType channel,
                                 const Sent_Ip_ChnCfgType *cfg);

/** *****************************************************************************************************
 * \brief Configure SENT enable operation.
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ChannelEnable(uint32_t base, Sent_Ip_ChannelType channel, bool enable)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      enable - true:Enables SENT channel reception.
 *                               false:Disables the SENT channel receive function.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Configure SENT enable operation.
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelEnable(uint32_t base, Sent_Ip_ChannelType channel, bool enable);

/** *****************************************************************************************************
 * \brief Configure SENT clock enable operation.
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ChannelClkEnable(uint32_t base, Sent_Ip_ChannelType channel,
 *                                                    bool enable)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      enable - true:Enables clock SENT channel reception.
 *                               false:Disables clock the SENT channel receive function.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Configure SENT clock enable operation.
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelClkEnable(uint32_t base, Sent_Ip_ChannelType channel, bool enable);

/** *****************************************************************************************************
 * \brief Configure SENT channel release config
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ChannelRelease(uint32_t base, Sent_Ip_ChannelType channel)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Configure SENT channel release config.
 *                      Does not affect registers, affects digital logic including FIFO clearing.
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelRelease(uint32_t base, Sent_Ip_ChannelType channel);

/** *****************************************************************************************************
 * \brief SENT Interrupt Initialization Configuration
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ChannelInterruptEnable(uint32_t base, Sent_Ip_ChannelType channel,
 *                                                          uint32_t interruptMsk)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      interruptMsk - The combination of Sent_Ip_ChannelStaType
 *                                      in the enumeration type.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : SENT Interrupt Initialization Configuration
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelInterruptEnable(uint32_t base, Sent_Ip_ChannelType channel, uint32_t interruptMsk);

/** *****************************************************************************************************
 * \brief Get the channel status
 *
 * \verbatim
 * Syntax             : uint32_t Sent_Ip_ChannelStaGet(uint32_t base,
 *                                      Sent_Ip_ChannelType channel)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : channel status
 *
 * Description        : Get the channel status
 * \endverbatim
 *******************************************************************************************************/
uint32_t Sent_Ip_ChannelStaGet(uint32_t base, Sent_Ip_ChannelType channel);

/** *****************************************************************************************************
 * \brief Get the channel irq status
 *
 * \verbatim
 * Syntax             : uint32_t Sent_Ip_ChannelIrqStaGet(uint32_t base,
 *                                      Sent_Ip_ChannelType channel)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : channel irq status
 *
 * Description        : Get the channel irq status
 * \endverbatim
 *******************************************************************************************************/
uint32_t Sent_Ip_ChannelIrqStaGet(uint32_t base, Sent_Ip_ChannelType channel);

/** *****************************************************************************************************
 * \brief Clear interrupt status
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ChannelStaClr(uint32_t base,
 *                          Sent_Ip_ChannelType channel, uint32_t bitMsk)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *                      bitMsk - Interrupt bit
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Clear interrupt status
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ChannelStaClr(uint32_t base, Sent_Ip_ChannelType channel, uint32_t bitMsk);

/** *****************************************************************************************************
 * \brief Get nibble data
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ReadNibData(uint32_t base,
 *                          Sent_Ip_ChannelType channel, Sent_Ip_NibDataType *nibData)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *
 * Parameters (inout) : nibData - nibble The structure of the data returned.
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Get nibble data
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ReadNibData(uint32_t base, Sent_Ip_ChannelType channel, Sent_Ip_NibDataType *nibData);

/** *****************************************************************************************************
 * \brief Get serial data
 *
 * \verbatim
 * Syntax             : void Sent_Ip_ReadSerData(uint32_t base,
 *                              Sent_Ip_ChannelType channel, Sent_Ip_SerDataType *serData)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - Channel ID
 *
 * Parameters (inout) : serData - serial The structure of the data returned.
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Get serial data
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_ReadSerData(uint32_t base, Sent_Ip_ChannelType channel, Sent_Ip_SerDataType *serData);

/** *****************************************************************************************************
 * \brief Get channel interrupt status
 *
 * \verbatim
 * Syntax             : uint32_t Sent_Ip_GetChannelIntSta(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : base - SENT base address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Get channel interrupt status
 * \endverbatim
 *******************************************************************************************************/
uint32_t Sent_Ip_GetChannelIntSta(uint32_t base);

/** *****************************************************************************************************
 * \brief Actual Calculation Result of Tick Period
 *
 * \verbatim
 * Syntax             : uint32_t Sent_Ip_GetChannelActualTick(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - SENT base address
 *                      channel - channelId
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : actual tick
 *
 * Description        : Actual Calculation Result of Tick Period
 * \endverbatim
 *******************************************************************************************************/
uint32_t Sent_Ip_GetChannelActualTick(uint32_t base, Sent_Ip_ChannelType channel);

/** *****************************************************************************************************
 * \brief Processing of serial data
 *
 * \verbatim
 * Syntax             : void Sent_Ip_SerDataProcess(uint32_t serFrame1,
 *                              uint32_t serFrame2, uint32_t timeStamp,
 *                              Sent_Ip_SerDataType *serData)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : reentrant
 *
 * Parameters (in)    : serFrame1 - fifo1 data
 *                      serFrame2 - fifo2 data
 *                      timeStamp - fifo time stamp
 *
 * Parameters (inout) : serData - serial The structure of the data returned.
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Processing of serial data
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_SerDataProcess(uint32_t serFrame1, uint32_t serFrame2, uint32_t timeStamp,
                                   Sent_Ip_SerDataType *serData);

/** *****************************************************************************************************
 * \brief Processing of nibble data
 *
 * \verbatim
 * Syntax             : void Sent_Ip_NibDataProcess(uint32_t nibFrame1,
 *                              uint32_t nibFrame2, uint32_t timeStamp,
 *                              Sent_Ip_NibDataType *nibData)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : reentrant
 *
 * Parameters (in)    : nibFrame1 - fifo1 data
 *                      nibFrame2 - fifo2 data
 *                      timeStamp - fifo time stamp
 *
 * Parameters (inout) : nibData - nibble The structure of the data returned.
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Processing of nibble data
 * \endverbatim
 *******************************************************************************************************/
void Sent_Ip_NibDataProcess(uint32_t nibFrame1, uint32_t nibFrame2, uint32_t timeStamp,
                                   Sent_Ip_NibDataType *nibData);

#endif /* SENT_IP_H */
/* End of file */
